//持久层
const mongoose = require("mongoose");
module.exports.getusers3 = async ({ currentPage, pageSize }) => {
    const total = await mongoose.model("usersModel").countDocuments();//用户数据总条数
    const pages = Math.ceil(total / pageSize);//计算用户列表的总页数
    const goodsData = await mongoose.model("usersModel")
        .find()
        .limit(pageSize - 0)
        .skip((currentPage - 1) * pageSize);
    return { total, pages, goodsData};
}


module.exports.login3 = async ({phone,pwd})=>{
    return await mongoose.model('usersModel').find({phone,pwd});
};

module.exports.register3 =async (user)=>{
    return await mongoose.model('usersModel').create(user);
}